package _28define.tcp;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Cilent {
    public static void main(String[] args) throws IOException {
        Socket socket=new Socket("localhost",8888);
        FileInputStream in=new FileInputStream("src/note/b.txt");
        OutputStream out=socket.getOutputStream();
        int readcount;
        byte[] bytes=new byte[1024];
        while ((readcount=in.read(bytes))!=-1){
            out.write(bytes,0,readcount);
        }
        System.out.println("Client while end");
        socket.shutdownOutput();

        InputStream inputStream=socket.getInputStream();
        byte[] bytes1=new byte[1024];
        int readcont2=inputStream.read(bytes1);
        System.out.println(new String(bytes1,0,readcont2));

        in.close();
        socket.close();
    }
}
